#include <buola/mat.h>
#include <buola/mat/prettyprint.h>
#include <buola/mat/svd.h>
#include <buola/mat/traits_typename.h>

using namespace buola;

int main(int /*argc*/,char** argv)
{
    {
        mat::CMat_d a{{1,2},{4,5}};
        mat::CMat_d b{{1,2},{4,5}};

        start_timer();
        double lSum=0;
        for(int i=0;i<10000000;i++)
        {
            mat::CMat_d s=a+b;
            lSum+=sum(s);
        }
        end_timer();
        msg_info() << lSum << "\n";
    }

    {
        mat::CMat_d a{{1,2},{4,5}};
        mat::CMat_d b{{1,2},{4,5}};

        start_timer();
        double lSum=0;
        for(int i=0;i<10000000;i++)
        {
            mat::CMat2d s=a+b;
            lSum+=sum(s);
        }
        end_timer();
        msg_info() << lSum << "\n";
    }

    ///\todo check why this is slower than previous one!!
    {
        mat::CMat2d a{{1,2},{4,5}};
        mat::CMat2d b{{1,2},{4,5}};

        start_timer();
        double lSum=0;
        for(int i=0;i<10000000;i++)
        {
            mat::CMat2d s=a+b;
            lSum+=sum(s);
        }
        end_timer();
        msg_info() << lSum << "\n";
    }
}
